﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Peak.Core;

namespace Peak.Web.Controllers.Models
{
  public class ModelHelper
  {
    public static string GetTaskStatuses()
    {
      //"{'Lorem ipsum':'Lorem ipsum','Ipsum dolor':'Ipsum dolor','Dolor sit':'Dolor sit'}"
      string result = "{";
      foreach (var status in Enum.GetValues(typeof(TaskStatus)))
      {
        if ((TaskStatus)status == TaskStatus.ReadyForTest)
        {
          continue;
        }
        result += "'" + ((int) status).ToString() + "':'" +
                  Resources.Statuses.ResourceManager.GetString(status.ToString()) + "',";
      }
      result.Remove(result.Length - 1, 1);
      return result + "}";
    }

    public static string GetBugStatuses()
    {
      //"{'Lorem ipsum':'Lorem ipsum','Ipsum dolor':'Ipsum dolor','Dolor sit':'Dolor sit'}"
      string result = "{";
      foreach (var status in Enum.GetValues(typeof(TaskStatus)))
      {
        result += "'" + ((int)status).ToString() + "':'" +
                  Resources.Statuses.ResourceManager.GetString(status.ToString()) + "',";
      }
      result.Remove(result.Length - 1, 1);
      return result + "}";
    }

    public static string GetStatusClassName(Task task)
    {
      if (task.Category != null && task.Category.ToLower().Contains("bug"))
        return "editBugStatus";
      else
        return "editTaskStatus";
    }

    public static string GetStatusClassName(DashboardItem task)
    {
      if (task.Category != null && task.Category.ToLower().Contains("bug"))
        return "editBugStatus";
      else
        return "editTaskStatus";
    }
  }
}
